//package com.example.demo.demos.netty;
//
//import io.netty.buffer.ByteBuf;
//import io.netty.buffer.Unpooled;
//import io.netty.channel.ChannelInitializer;
//import io.netty.channel.ChannelPipeline;
//import io.netty.channel.socket.SocketChannel;
//import io.netty.handler.codec.DelimiterBasedFrameDecoder;
//import io.netty.handler.codec.FixedLengthFrameDecoder;
//import io.netty.handler.codec.LengthFieldBasedFrameDecoder;
//import io.netty.handler.codec.string.StringDecoder;
//import io.netty.handler.codec.string.StringEncoder;
//import lombok.RequiredArgsConstructor;
//import org.springframework.stereotype.Component;
//
//@Component
//@RequiredArgsConstructor
// public class ServerHandlerInit extends ChannelInitializer<SocketChannel> {
//
//    @Override
//    protected void initChannel(SocketChannel ch) throws Exception {
//        ChannelPipeline pipeline = ch.pipeline();
//        // 解码出具体的数据类型
//        //该篇对解码器和编码器进行了详细说明，推荐阅读https://blog.csdn.net/tang_huan_11/article/details/133853786
////            pipeline.addLast("decoder", new StringDecoder());//解码和编码可以自己定义
////            pipeline.addLast(new Handler());//handler类是自己写的处理类
////            pipeline.addLast("encoder", new StringEncoder());
////        ByteBuf buffer = Unpooled.buffer();
////        buffer.writeByte(0xaa);
////        pipeline.addLast(new FixedLengthFrameDecoder(12));
//        pipeline.addLast(new LengthFieldBasedFrameDecoder(1024,1,1,-1,2));
//        pipeline.addLast(new TestHandler());
//    }
//}
